Update dependency flex_color_scheme to v8 #1365
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^7.3.1->^8.0.0Warning
Some dependencies could not be looked up. Check the Dependency Dashboard for more information.
Release Notes
rydmike/flex_color_scheme (flex_color_scheme)
v8.0.0Compare Source
Nov 3, 2024
SUMMARY
Version 8.0.0 makes FlexColorScheme fully aligned with Flutter's MAJOR BREAKING Material-3 theming changes introduced in Flutter version 3.22. Due to Flutter 3.22 breaking many past Material styles, introducing new colors to
ColorSchemeand deprecating three colors, FlexColorScheme had to undergo major revision and also break many of its past styles and some older APIs.Most APIs are still there and work as before, but a few produce results that differ slightly from past ones, just like Flutter 3.22 also does over previous versions. Generally, the upgrade should be smooth, but you may need to review the produced theme result to see that you don't get any changes that don't fit with your design goals. Some past defaults have changed in FCS V8, but previous settings are still available. However, you will need to enable them explicitly to get the same results as before. The purpose of these default value changes is to make FCS have less opinionated defaults, and be more aligned with Flutter's Material-3 design defaults. The Themes Playground app will still have some of its own opinionated defaults, done via default settings values the app uses in its default configuration, but the package Material-3 default starting points are now much more aligned with Flutter's Material-3 defaults.
In the Themes Playground you can now export and import settings to a JSON file, and import them back into the Playground later. This is a great way to save your theme settings for later re-use. The exported JSON contains all the internal controller settings values you have configured in the Playground app, that are needed to restore a given configuration state. This Playground feature was a nice contribution by GitHub user @akiller in !PR 257, thank you! This contributed feature got enhanced with more error handling and a slightly refined UI to make it production ready. As a further enhancement of the JSON export feature, the Themes Playground app also got the ability to convert the exported settings JSON config to a shareable URL. You can now share Playground settings with other Flutter developers.
MIGRATION
The most critical changes to migrate from FlexColorScheme V7 to V8 are listed below. For a full list of all breaking changes, see PACKAGE CHANGES and the BREAKING part further below.
The flag
useMaterial3now defaults totrueinFlexColorSchemeandFlexThemeDataconstructors. Set it tofalseto explicitly use Material-2 theming. It defaulted to true before. Material-2 is still fully supported in FCS v8 and Flutter v3.24, but will eventually be deprecated in Flutter, when that happens, it will also happen in FCS.The
FlexSubThemesDatapropertiesinteractionEffects,tintedDisabledControls,defaultUseM2StyleDividerInM3andblendOnColorsnow all default tofalse. In previous versions they defaulted totrue. If you before had not explicitly turned these propertiesfalse, they were alltrueby default. To get the same result as before in FCS V8, you now have to set these properties totrue. This change was made to have fewer opinionated defaults in FCS to align it more with Flutter SDK default styles.The
FlexSubThemesDatapropertynavigationRailLabelTypeno default toNavigationRailLabelType.none. To get the same result as before by default, you will need to set it toNavigationRailLabelType.all. This change was made to have fewer opinionated defaults in FCS to align it more with Flutter SDK default styles. The Playground defaults it toNavigationRailLabelType.allby adding this by default to new default themes.Since
ColorScheme.backgroundcolor was deprecated in Flutter 3.22.0 we can no longer use it as a part of surface blends and its modes. For example, whensurfaceModeis set toFlexSurfaceMode.highBackgroundLowScaffoldit now uses surface and dialog blends set to 2x instead of 1x, so that it represents the "high background" style as before, but done via surface color. Without this breaking change, this mode would produce the same result asFlexSurfaceMode.levelSurfacesLowScaffoldand be redundant.ColorSchemecolorsbackground,onBackgroundandsurfaceVariant.This major release has many breaking changes forced via breaking changes in Flutter 3.22.0. Due to this, the release also uses this opportunity to clean up APIs with opinionated defaults, like the ones mentioned above. There are additional smaller and more subtle changes in defaults values, that align FCS to use the same color defaults from the new
ColorSchemecolors, that Flutter started using in version 3.22.0 as well. You can find all the details below in the PACKAGE CHANGES chapter.BACKGROUND
Flutter 3.22 introduced a large number of breaking changes to the
ColorSchemeand default color mappings that Flutter's Material components use. In total, the Flutter 3.22.0 release adjusted 249 of its own internal tests to accommodate for new Material-3 spec changes, that all broke past Flutter Material-3 component styles. For a reference to the broken and updated tests, see this issue side comment.FlexColorScheme V8 now allows you to use the new colors introduced in Flutter 3.22. As before, with FCS you can get fully defined hand-tuned
ColorSchemes without using Material-3 design's Material Color Utilities (MCU) based seed-generated ColorSchemes. You may prefer to use seed generated ColorSchemes with Material-3, but it is nice to know you do not have to.To the seed generated
ColorSchemes, FCS adds support for all the FlutterDynamicSchemeVariantseed generated variants. It also improves them by allowing you to use separate seed colors for each palette. With Flutter'sColorScheme.fromSeed, you can only seed with one color, the primary color. The resultingColorSchemealways uses computed values for secondary and tertiary palettes, plus a hard coded fixed color for the error palette seeding. Surfaces colors are always tied to primary color as well and include a hint of primary color. With FCS, you do not have these limitations, you can seed with separate colors for each palette with even with Flutter's own dynamic scheme variants. This was always possible with FlexColorScheme and its FlexSeedScheme (FSS) based FlexTones, seed generated scheme variants. FCS now brings this feature to Flutter's own dynamic scheme variants as well.As before, FCS also has its own even configurable
FlexTonesway of making seed generated ColorSchemes. Typically, you use predefinedFlexTones, but you can also create your ownFlexTonesconfigurations. With it, you can define the chroma goals for each palette and define which tone is mapped to whatColorSchemecolor. An internal example of using them is the implementation ofFlexTonesmodifiers.FlexColorScheme V8 adds three new
FlexTonesmodifiers. The most useful one is calledmonochromeSurfaces(). This tone modifier makes the surface shades of any usedFlexTonesconfiguration use monochrome greyscale shades for the surface and surface variant palettes. It thus gives us greyscale colors for ALL surfaces, instead of primary-tinted ones. It can be applied to anyFlexTonesseed generated scheme variant. The other new modifiers areexpressiveOnContainer()andhigherContrastFixed(). Check the API docs for more details.PACKAGE CHANGES
This section contains a detailed list of all changes introduced in FlexColorScheme version 8.0.0.
BREAKING CHANGES
This version contains a lot of breaking changes due to updates in the Material-3 ColorScheme in Flutter 3.22. At the same time, this release uses the forced breaking change to clean up some older APIs. FCS is now more aligned with Flutter's Material-3 theming defaults, by typically using them as starting points in the default Material-3 mode. Material-2 mode is still supported, it has its own opinionated defaults as before.
The
ThemeDataflaguseMaterial3is now true by default to align with Flutter 3.16.0 and later default for ThemeData. To continue using Material-2 theming, setuseMaterial3to false. All component themes inFlexSubThemesthat have auseMaterial3property now also default to true.Keeping to Material-3 defaults, in the theme factories
lightanddark, ifschemeis undefined it now defaults toFlexScheme.materialBaselinethe Material-3 baseline scheme, whenuseMaterial3is true. IfuseMaterial3is false andschemeis undefined, it defaults toFlexScheme.material, the default Material-2 theme, as before.Removed ALL references to in Flutter 3.22 deprecated
ColorSchemecolorsbackground,onBackgroundandsurfaceVariant. They are not used in FCS anymore. Thebackgroundcolor was critical for FCS surface blending, it is now handled differently. The removal of theseColorSchemecolors had far-reaching, but typically still subtle implications on styles created by FCS. There are many breaking minor style changes in this release due to this. Here are the critical changes caused by all these breaking changes in Flutter 3.22:backgroundandonBackgroundcolors inFlexColorScheme,FlexColorScheme.light,FlexColorScheme.dark,FlexThemeData.lightandFlexThemeData.darkfactories. They are not used anymore. UsesurfaceandonSurfacecolors instead.background,onBackground,surfaceVariantfromFlexSchemeOnColorsandFlexSchemeSurfaceColors. They are no longer used and have no function. They were deprecated since the same colors were deprecated inColorSchemein Flutter 3.22.surfaceVariantAlphaandbackgroundAlphacolors inFlexAlphaValues. They are not used anymore and have no function, usesurfaceAlphainstead. They were deprecated since the colors they related to were deprecated inColorSchemein Flutter 3.22.FlexSchemeSurfaceColors.blendfactory constructor produces slightly different blend result than in earlier versions. Because Flutter 3.22 deprecatedColorSchemecolorsbackground,onBackgroundandsurfaceVariant, that were used in the blend calculation earlier. It is no longer possible to produce the same results as before, but the results are equivalent to previous design intent. With one exception, usingsurfaceModewithFlexSurfaceMode.highBackgroundLowScaffoldsets surface and dialog blends to 2x instead of 1x, so that it represents the "high background" style as before, but done via surface. Without this breaking change, this mode would produce the same resultFlexSurfaceMode.levelSurfacesLowScaffoldand be redundant.SchemeColorremoved all the corresponding colors that Flutter 3.22 deprecated. This is a VERY breaking change and will break your code if you happened to use any of the removed enum values. This may likely happen. The removed enum values are:SchemeColor.background,SchemeColor.onBackgroundandSchemeColor.surfaceVariant. For background Flutter recommends that you should use the valuesSchemeColor.surfaceandSchemeColor.onSurfaceinstead and forsurfaceVarianttheSchemeColor.surfaceContainerHighestis recommended. In all cases you can try the other new surface colors as well, to see what best fits your design goals and intent.SchemeColorgot support for all the new colors in Flutter 3.22ColorScheme. It also removed the colors Flutter 3.22 deprecated. The order of the enum values was modified. This will break usage that depends on the enum's index, for example, storage of the values for implementations that depend on the index value.systemNavBarStyleinFlexColorScheme.themedSystemNavigationBarnow defaults toFlexSystemNavBarStyle.surface, instead ofFlexSystemNavBarStyle.background. UsingFlexSystemNavBarStyle.backgroundresults in the colorTheme.of(context).colorScheme.surfaceContainerLowbeing used, where it previously wasTheme.of(context).colorScheme.background. This is because Flutter 3.22 deprecatedColorSCheme.background.FlexAppBarStylevaluebackgroundnow results in theAppBarusing thesurfaceContainerLowcolor instead ofbackground. This breaking change was introduced because of the breaking change in Material-3 in Flutter 3.22 where the colorbackgroundwas deprecated. The new color is kind of the best match for the oldbackgroundcolor in a typical FCS configuration.FlexSystemNavBarStylevaluebackgroundnow results in the app bar using thesurfaceContainerLowcolor instead ofbackground. This breaking change was introduced because of the breaking change in Material-3 in Flutter 3.22 where the colorbackgroundwas deprecated. The new color is kind of the best match for the oldbackgroundcolor in typical FCS configuration.Breaking rename: All helper component themes in
FlexSubThemesended withTheme, as designed, exceptFlexSubThemes.bottomNavigationBar. This mistake is now corrected, it was renamed toFlexSubThemes.bottomNavigationBarTheme. The old version is deprecated and passes its props through to the renamed version. The old and wrong named one will be removed in version 9.0.0.Deprecated
FlexSubThemesData.blendTextTheme, it no longer has any function. See topic "Why is blendTextTheme deprecated?" further below for more information,Deprecated the FCS legacy property
useFlutterDefaults. FlexColorScheme in Material-3 mode now defaults to using Flutter default styles. For other configurations, modify them as desired. In Material-2 mode, FCS continues to use its opinionated own defaults as before, as long as Material-2 exists.Deprecated the static function
FlexColorScheme.createPrimarySwatch, it is no longer used by FlexColorScheme internally, it is now deprecated in FlexColorScheme and will go away in V9. After this, you will still be able to find this function inColorToolsin the packageflex_Color_picker, where it will remain available.Replaced the FCS legacy property
useTextThemewith a more feature correctly named propertyuseMaterial3Typography. Use it instead. TheuseTextThemeoriginally had another function in much older versions of FCS. Its name no longer represented its function, the new name does. If not defined, the default istruein Material-3 mode andfalsein Material-2 mode. If you still use Material-2, try setting this to true to get nicer typography in Material-2 mode.The color
material3DarkOnErrorContainerwas changed fromColor(0xFFFFB4AB)toColor(0xFFFFDAD6)to match the new Material-3 default dark error color used in Flutter 3.22.Dialog background color now defaults to
surfaceContainerHighwith no elevation tint color in Material-3 mode, instead ofsurfacewith elevation tint. Breaking change introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The
ElevatedButtonbackground color now defaults tosurfaceContainerLowwith no elevation tint color in Material-3 mode, instead ofsurfacewith elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The
PopupMenuButtonbackground color now defaults tosurfaceContainerwith no elevation tint color in Material-3 mode, instead ofsurfacewith elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The
MenuBarbackground color now defaults tosurfaceContainerinstead ofsurfacewith elevation tint in Material-3 mode. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The produced
MenuThemebackground color now defaults tosurfaceContainerwith no elevation tint color in Material-3 mode, instead ofsurfacewith elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22. This affects default background color of the opened menu onMenuBar,MenuAnchorandDropdownMenu.The
BottomSheetbackground color now defaults tosurfaceContainerLowwith no elevation tint color in Material-3 mode, instead ofsurfacewith elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22.The produced
DrawerThemebackground color now defaults tosurfaceContainerLowwith no elevation tint color in Material-3 mode, instead ofsurfacewith elevation tint. This breaking change was introduced to match the breaking change in Material-3 defaults in Flutter 3.22. This affects the default background color of theDrawerandNavigationDrawer. FCS usessurfaceContainerLowas background color in Material-2 mode by default too.The produced
DrawerThemewidth now defaults to 304 dp in Material-3 mode. The [official Material-3 spec is 360 dp](Material-3 spec https://m3.material.io/components/navigation-drawer/specs), FCS was using it, but Flutter SDK has so far "declined" following the Material-3 spec here and still uses the older default 304 dp used in the Material-2 spec. This older default is actually a better choice, so FCS has now opted to revert to using it as default too. For more information about this and why 304 dp is better, see Flutter issue #123380.The
FlexSubThemesDatapropertiesinteractionEffects,tintedDisabledControlsanddefaultUseM2StyleDividerInM3now all default tofalse. In previous versions they defaulted totrue. This change was made to have fewer opinionated defaults in FCS to align it more with Flutter SDK default styles. If you had NOT configured these values before, they defaulted totrue. You now have to set them explicitly totrueto opt in and get the same results as you got before when they were not configured.The
FlexSubThemesDatapropertiesblendOnColorsnow defaults tofalse. In previous versions it defaulted totrue. This change was made to have fewer opinionated defaults in FCS, to align it more with Flutter defaults. If you had NOT configured this values before, it defaulted totrue. You now have to set it explicitly totrueto get the same result as before, when it was not configured. Consider setting this propertytruein dark mode, and false inlighttheme mode, for a style that matches the Material-3 color design, when you are not using a seed generatedColorScheme. This setting has no effect when using a seed generatedColorScheme, as it generates blended/tinted onColors based on the seed algorithm, that overrides the effect of this setting. This setting creates a similar effect for none seeded ColorSchemes.The
FlexSubThemesDatapropertyinputSelectionHandleSchemeColorwhen not defined, defaults toinputDecoratorSchemeColorand if it is not defined either, the effective text selection handle color result isColorScheme.primary, same as Flutter SDK default. In previous versions, no definitions, resulted inThemeData.primaryColorDarkbeing used. This was changed in preparation of Flutter's planned deprecation ofprimaryColorDark.The
FlexSubThemesDatapropertyinputDecoratorIsFillednow default tofalsewhen undefined, like Flutter SDK does. Set it totrueto get the same style it had with previous undefined value.The
FlexSubThemesDatapropertyinputDecoratorBorderTypenow default toFlexInputBorderType.underlinewhen undefined, producing same default as Flutter SDK does. Set it toFlexInputBorderType.outlineto get the same style it had with previous undefined value.The
FlexSubThemesDatapropertyinputDecoratorUnfocusedBorderIsColorednow default tofalsewhen undefined, like Flutter SDK does. Set it totrueto get the same style it had with previous undefined value.In
FlexSubTheme.InputDecorationThemethe following properties have new breaking default values:filleddefault tofalse,borderTypedefault toFlexInputBorderType.underlineandunfocusedBorderIsColoredtofalse.The
FlexSubThemesDatapropertiesnavigationRailMutedUnselectedLabelandnavigationRailMutedUnselectedIconnow default tofalse. In previous versions they defaulted totrue. This change was made to have fewer opinionated defaults in FCS and follow Material-3 design spec by default.The
FlexSubThemesDatapropertiesnavigationRailUseIndicatornow defaults tonull, resulting intruebeing used in Material-3 mode andfalsein Material-2 mode. In previous versions it defaulted totrue. This change was made to have fewer opinionated defaults in FCS and follow Material design specs for default values. If you still use Material-2, you now have to set this to true to see the indicator. The Playground now always sets either true or false in both modes, it never leaves out the default choice in generated config code. The field is nullable, and you can now also get the M2/M3 different default styles, by not defining this property at all.In
FlexSubThemes.navigationRailThemethe propertiesmutedUnselectedLabelandmutedUnselectedIconnow default tofalseif undefined. In previous versions they defaulted totrue. PropertyselectedLabelSchemeColordefaults toonSurfaceandunselectedLabelSchemeColordefault toonSurfaceVariant, they wereprimarybefore. PropertyunselectedIconColornow defaults toonSurfaceVariantit wasonSurface. PropertyselectedIconColornow defaults toonSecondaryContainerit wasprimary. PropertylabelTypenow defaults toNavigationRailLabelType.noneit wasNavigationRailLabelType.all.The
FlexSubThemesDatapropertiesnavigationRailUnselectedLabelSchemeColorandnavigationRailUnselectedIconSchemeColornow default toonSurfaceVariant(wasonSurface). TheonSurfaceVariantis used as on color pair default when any surface color is used as background color for the rail, if a none surface color is used as background scheme color, its contrast color pair is used as default for the labels and unselected icons. ThenavigationRailSelectedIconSchemeColorwill if undefined, default to the contrast color pair fornavigationRailIndicatorSchemeColor. These default behaviors result in less configuration in typical designs, while starting points defaults are the same as before and full configuration options are also available as before. The equivalent colors inFlexSubThemes.navigationRailThemebehave the same way.The
FlexSubThemesDatapropertiesnavigationBarMutedUnselectedLabelandnavigationBarMutedUnselectedIconnow default tofalse. In previous versions they defaulted totrue. This change was made to have fewer opinionated defaults in FCS and follow Material-3 design spec by default.In
FlexSubThemes.navigationBarThemethe propertiesmutedUnselectedLabelandmutedUnselectedIconnow default tofalseif undefined. In previous versions they defaulted totrue. PropertyselectedLabelSchemeColordefaults toonSurfaceandunselectedLabelSchemeColordefault toonSurfaceVariant, they wereprimarybefore. PropertyunselectedIconColornow defaults toonSurfaceVariantit wasonSurface. PropertyselectedIconColornow defaults toonSecondaryContainerit wasprimary.The
FlexSubThemesDatapropertiesnavigationBarUnselectedLabelSchemeColorandnavigationBarUnselectedIconSchemeColornow default toonSurfaceVariant(wasonSurface). TheonSurfaceVariantis used as on color pair default when any surface color is used as background color for the rail, if a none surface color is used as background scheme color, its contrast color pair is used as default for the labels and unselected icons. ThenavigationBarSelectedIconSchemeColorwill if undefined, default to the contrast color pair fornavigationBarIndicatorSchemeColor. These default behaviors result in less configuration in typical designs, while starting points defaults are the same as before and full configuration options are also available as before. The equivalent colors inFlexSubThemes.navigationBarThemebehave the same way.The
FlexSubThemesDatapropertiesbottomNavigationBarMutedUnselectedLabelandbottomNavigationBarMutedUnselectedIconnow default tonull, resulting intruebeing used as default in Material-2 mode andfalsein Material-3 mode. In previous versions these properties defaulted totruein both modes. This change was made to have fewer opinionated defaults in FCS.The
FlexSubThemesDatapropertiesbottomNavigationBarUnselectedLabelSchemeColorandbottomNavigationBarUnselectedIconSchemeColornow default toonSurfaceVariantin Material-3 mode, it wasonSurface, which remains the default in Material-3 mode. In Material-3 mode, theonSurfaceVariantis used as on color pair default when any surface color is used as background color for the navigation bar. If a none surface color is used as background scheme color, its contrast color pair is used as default for the labels and unselected icons, in both Material-2 and Material-3 mode. These default behaviors result in less configuration in typical designs, while starting points defaults are the same as before and full configuration options are also available as before. The equivalent colors inFlexSubThemes.bottomNavigationBarbehave the same way.The
FlexSubThemesDatapropertychipDeleteIconSchemeColornow default toSchemeColor.onSurfaceVariant. In previous versions it defaulted toSchemeColor.onSurface. Likewise inFlexSubThemes.chipThemethe propertydeleteIconSchemeColornow defaults toSchemeColor.onSurfaceVariantif undefined. In previous versions it defaulted toSchemeColor.onSurface. This change was made to adjust to follow updated Material-3 spec defaults.The
FlexSubThemesDatapropertydrawerUnselectedItemSchemeColornow default toSchemeColor.onSurfaceVariant, as on color pair default when any surface color is used as drawer background color. Previously it defaulted toonSurface. Likewise inFlexSubThemes.navigationDrawerThemethe propertyunselectedItemSchemeColornow defaults toSchemeColor.onSurfaceVariantif undefined. This was changed to use ase as Material-3 defaults.Minor style breaking, the tinted interactions were slightly modified. They are now a bit less pronounced and also have a bit less gray in them.
NEW
Added three new
FlexSchemes, calledblackWhite,greysandsepia. They are primarily intended to be used as prototype phase color schemes that do not use colors. This can be useful for focusing on features and layout during the early development phase, keeping the discussion away from colors. The schemes can also be used as neutral baselines for custom color schemes, where only a few colors are overridden with custom colors.The const color definition class
FlexColorgot 24 new color values to support monochrome greyscale colors for all new surfaces and their on colors for light and dark mode. These are used as starting colors for the new surface colors in the Flutter 3.22 updated and new Material-3ColorScheme, when a seed generatedColorSchemeis NOT used. These colors follow the naming conventionlightFlexSurface___anddarkFlexSurface___, plus their on and inverse versions.Added named bool parameter
useOnSurfaceVariantthat defaults tofalse, toFlexSubTheme.schemeColorPair()and toFlexSubTheme.onSchemeColor(), when set to true, the on coloronSurfaceVariantis returned instead foronSurfacefor all surface colors.Added
black,whiteandtransparentas enum values toSchemeColor. These are notColorSchemecolors, but these colors can in many theming situations be useful instead of theColorSchemebased ones.onSurface.Added all the new surface colors in Flutter 3.22 to
FlexSchemeSurfaceColors.Added all the new on colors in Flutter 3.22 to
FlexSchemeOnColors.The
FlexKeyColorclass got three new properties,contrastLevel,useExpressiveOnContainerColorsanduseLegacyMonochromeSeedBehavior. They are used to control seed generation results.The
contrastLevelis used to control the contrast level of MCU generated scheme colors. ThecontrastLevelparameter indicates the contrast level between color pairs, such asprimaryandonPrimary. The value 0.0 is the default, standard contrast; -1.0 is the lowest; 1.0 is the highest. From the Material-3 Design guideline, the standard, medium and high contrast options correspond to values 0.0, 0.5 and 1.0 respectively.contrastLevelproperty is only available when seed generating aColorSchemeusingFlexSeedScheme'sSeedColorScheme.fromSeedswhen a schemevariantis used where itsFlexSchemeVariant.value,isFlutterSchemeis true. This set corresponds to all theDynamicSchemeVariants available in the Flutter SDK.contrastLevelis the same as the FluttercontrastLevelproperty available inColorScheme.fromSeed. As of Sep 3, 2024, thiscontrastLevelis still only available in the master channel. It will land in the next Flutter stable, released after Flutter 3.24. With FCS v8 you can use it already now.The boolean
useExpressiveOnContainerColorsis used to make the light theme mode colorsonPrimaryContainer,onSecondaryContainer,onTertiaryContainerandonErrorContainermore color expressive, at the cost of their contrast level and accessibility. Defaults tofalseif undefined.onPrimaryContainer,onSecondaryContainer,onTertiaryContainerandonErrorContainerhave changed from tone 10 to 30 for LIGHT theme mode. This change will land in Flutter when the Material Color Utilities (MCU) package is updated to at least 0.12.0. This has not been done even in master (Sep 3, 2024).useExpressiveOnContainerColorstotruewill make the colors use the new expressive tone. The expressive tone spec is not yet used in Flutter SDK, but is in the Material-3 design spec and also in MCU v 0.12.0. When this change lands in stable Flutter, it will be made ON by default in FCS too. You will still be able to opt out of using it. Flutter SDK and MCU will not contain such an opt-out feature.useExpressiveOnContainerColorstofalse. With it set to false, you will also keep this preference when the Flutter SDK defaults to using the expressive tones.The boolean
useLegacyMonochromeSeedBehavioris used for enabling the legacy behavior for monochrome seed colorsuseLegacyMonochromeSeedBehaviortotrue.false.respectMonochromeSeedinSeedColorScheme.fromSeedsin FlexSeedScheme's internal MCU fork, and sets it!useLegacyMonochromeSeedBehavior. In FSS this feature is opt-in and recommended to be used. Here, in FCS this setting is opt-out if not desired, and it is strongly recommended to use the new behavior. When usinguseLegacyMonochromeSeedBehaviorwithAdded TextStyles for
FlexSubThemesDataso that:FlexSubThemes.appBarThemeusesFlexSubThemesData.appBarToolbarTextStylefor itstoolbarTextStyle.FlexSubThemes.appBarThemeusesFlexSubThemesData.appBarTitleTextStylefor itstitleTextStyle.FlexSubThemes.chipThemeusesFlexSubThemesData.chipLabelStylefor itslabelStyle.FlexSubThemes.chipThemeusesFlexSubThemesData.chipSecondaryLabelStylefor itssecondaryLabelStyle.FlexSubThemes.datePickerThemeusesFlexSubThemesData.datePickerHeaderHeadlineStylefor itsheaderHeadlineStyle.FlexSubThemes.datePickerThemeusesFlexSubThemesData.datePickerHeaderHelpStylefor itsheaderHelpStyle.FlexSubThemes.datePickerThemeusesFlexSubThemesData.datePickerWeekdayStylefor itsweekdayStyle.FlexSubThemes.datePickerThemeusesFlexSubThemesData.datePickerDayStylefor itsdayStyle.FlexSubThemes.datePickerThemeusesFlexSubThemesData.datePickerYearStylefor itsyearStyle.FlexSubThemes.datePickerThemeusesFlexSubThemesData.datePickerRangePickerHeaderHeadlineStylefor itsrangePickerHeaderHeadlineStyle.FlexSubThemes.datePickerThemeusesFlexSubThemesData.datePickerRangePickerHeaderHelpStylefor itsrangePickerHeaderHelpStyle.FlexSubThemes.dialogThemeusesFlexSubThemesData.dialogTitleTextStylefor itstitleTextStyle.FlexSubThemes.dialogThemeusesFlexSubThemesData.dialogContentTextStylefor itscontentTextStyle.FlexSubThemes.floatingActionButtonThemeusesFlexSubThemesData.fabExtendedTextStylefor itsextendedTextStyle.FlexSubThemes.menuButtonThemeusesFlexSubThemesData.menuButtonTextStylefor itstextStyle.FlexSubThemes.timePickerThemeusesFlexSubThemesData.timePickerDayPeriodTextStylefor itsdayPeriodTextStyle.FlexSubThemes.timePickerThemeusesFlexSubThemesData.timePickerDialTextStylefor itsdialTextStyle.,FlexSubThemes.timePickerThemeusesFlexSubThemesData.timePickerHelpTextStylefor itshelpTextStyle.,FlexSubThemes.timePickerThemeusesFlexSubThemesData.timePickerHourMinuteTextStylefor itshourMinuteTextStyle.,FlexSubThemes.toggleButtonsThemeusesFlexSubThemesData.toggleButtonsTextStylefor itstextStyle.FlexSubThemes.segmentedButtonThemeusesFlexSubThemesData.segmentedButtonTextStylefor itstextStyle.FlexSubThemes.snackBarThemeusesFlexSubThemesData.snackBarContentTextStylefor itscontentTextStyle.copyWithon the produced component themes. With these props you get access to directTextStylestyling for these component properties in the FCS API too.Added
useCupertinoStyleproperty toFlexSubThemes.switchTheme. AddedswitchAdaptiveCupertinoLikeproperty toFlexSubThemesDataand madeFlexSubThemes.switchThemeuse it.Added
secondarySelectedSchemeColor,fontSize,secondaryFontSize,iconSizeandpaddingproperties toFlexSubThemes.chipTheme. AddedchipSecondarySelectedSchemeColor,chipFontSize,chipSecondaryFontSize,chipIconSizeandchipPaddingproperties toFlexSubThemesDataand madeFlexSubThemes.chipThemeuse them.Added
headerForegroundSchemeColorproperty toFlexSubThemes.datePickerTheme. AddeddatePickerHeaderForegroundSchemeColorproperty toFlexSubThemesDataand madeFlexSubThemes.datePickerThemeuse it for its header foreground color.Added
dividerSchemeColorproperty toFlexSubThemes.datePickerTheme. AddeddatePickerDividerSchemeColorproperty toFlexSubThemesDataand madeFlexSubThemes.datePickerThemeuse it for its divider color.Added
isDenseproperty toFlexSubThemes.inputDecoratorTheme. AddedinputDecoratorIsDenseproperty toFlexSubThemesData.Added
contentPaddingproperty toFlexSubThemes.inputDecoratorTheme. AddedinputDecoratorContentPaddingproperty toFlexSubThemesDataand madeFlexSubThemes.inputDecoratorThemeuse it.Added
inputDecoratorSuffixIconSchemeColorproperty toFlexSubThemes.inputDecorationTheme. AddedtoggleButtonsSelectedForegroundSchemeColorproperty toFlexSubThemesDataand madeFlexSubThemes.segmentedButtonThemeuse it.Added
adaptiveInputDecoratorRadiusandinputDecoratorRadiusAdaptiveproperties toFlexSubThemesData. They are used to select platform(s) to an alternative border radius response for the input decorator, for the selected platform(s).Added
minWidthandminExtendedWidthtoFlexSubThemes.navigationRailTheme. AddednavigationRailMinWidthandnavigationRailMinExtendedWidthproperties toFlexSubThemesDataand madeFlexSubThemes.navigationRailThemeuse them.Added
tabAlignmentproperty toFlexSubThemes.tabAlignment. AddedtabBarTabAlignmentproperty toFlexSubThemesDataand madeFlexSubThemes.tabBarThemeuse it for its. (TODO: Add a note about thrown assert, open an issue in Flutter SDK about it and suggest an alternative solution.)Added
foregroundSchemeColorproperty toFlexSubThemes.floatingActionButtonTheme. AddedfabForegroundSchemeColorproperty toFlexSubThemesDataand madeFlexSubThemes.floatingActionButtonThemeuse it for its foreground color.Added
selectedForegroundSchemeColorproperty toFlexSubThemes.segmentedButtonTheme.Added
segmentedButtonSelectedForegroundSchemeColorproperty toFlexSubThemesDataand madeFlexSubThemes.segmentedButtonThemeuse it.Added
selectedForegroundSchemeColorproperty toFlexSubThemes.toggleButtonsTheme.Added
toggleButtonsSelectedForegroundSchemeColorproperty toFlexSubThemesDataand madeFlexSubThemes.toggleButtonsThemeuse it.Added
appBarForegroundSchemeColor,appBarIconSchemeColorandappBarActionsIconSchemeColorproperties toFlexSubThemesDataand madeFlexSubThemes.appBarThemeuse it for its colors on title, icon and actions.Added
bottomAppBarHeightproperty toFlexSubThemesDataand madeFlexSubThemes.bottomAppBarThemeuse it as itsheightvalue.Added
scaffoldBackgroundBaseColorproperty toFlexSubThemesData. It is aFlexScaffoldBaseColorenum that can be used to select the base color used asThemedata.scaffoldBackgroundColorin a theme. The selected base color is modified by usedsurfaceModeandblendLevel] in theFlexColorScheme'slightanddarkfactory constructors.Added
scaffoldBackgroundSchemeColorproperty toFlexSubThemesDataand madeThemeData.scaffoldBackgroundColoruse it as an override color, if it is defined. SettingscaffoldBackgroundSchemeColorwill override any blended background or true black or plain white setting.Added
cupertinoOverrideThemetoFlexColorSchemeconstructor and toFlexColorScheme.light,FlexColorScheme.dark,FlexThemeData.lightandFlexThemeData.darkfactory constructors.Added enum
variantaFlexSchemeVarianttoFlexColorsSchemeandFlexThemeDatalight and dark. This is used to define the variant of the seededColorScheme. It is an alternative totonesthat also includes scheme seed variants that Flutter SDK added in version 3.22.2.Added enhanced enum functions
dataandcolorsto theFlexSchemeenum, that returns the predefinedFlexSchemeDataandFlexSchemeColorrespectively, that are associated with a given enum value. This could be done already using theFlexColor.schemesmap. This is a convenience API to be able to use e.g.FlexColor.mango.datato get the predefinedFlexSchemeDatafor themangoenum scheme and e.g.FlexColor.barossa.colors(Brightness.dark)to get the pre-defined dark colors used for thebarossascheme colors. See feature request: https://github.com/rydmike/flex_color_scheme/issues/210Added ability to use custom seed key colors to
FlexKeyColors.Added support for error colors to
FlexKeyColors.Added direct color properties for
errorContainerandonErrorContainertoFlexColorScheme,FlexColorScheme.light,FlexColorScheme.dark,FlexThemeData.light,FlexThemeData.dark. It was required to support custom error container colors in theFlexKeyColorsAPI.Added
ColorpropertiesprimaryLightRef,secondaryLightRefandtertiaryLightReftoFlexSchemeColor.FlexSchemeColormade for light mode in the dark modeFlexSchemeColor. This is used to create computed "fixed" and "fixedDim" colors for dark mode and the light modeColorSchemethat are identical in light and dark mode.FlexSchemeColor(),FlexSchemeColor.from(),FlexSchemeColor.effective()andFlexSchemeColor.toDark()work correctly with the newprimaryLightRef,secondaryLightRefandtertiaryLightRefproperties.lightcolor properties inFlexSchemeDatastaticFlexSchemeColorcolor definitions, as lightRef colors in theirdarkmode equivalent FlexSchemeColor. That was 156 color values to add to the 52 darkFlexSchemeColordefinitions.Added
fixedColorStyletoFlexColorScheme,FlexColorScheme.light,FlexColorScheme.dark,FlexThemeData.light,FlexThemeData.dark. It was required to support custom error container colors in theFlexKeyColorsAPI. The property is an enumFlexFixedColorStyle, that allows us to choose the style of the generated "fixed" and "fixedDim" colors when not using seed generated color schemes.Added
ColorpropertiesprimaryLightRef,secondaryLightRefandtertiaryLightReftoFlexColorScheme.darkandFlexThemeData.dark. If you use the override colorsprimary,secondaryortertiaryand are not using seeded ColorScheme, you need them to provide the correct light mode reference colors for computing fixed colors that will match the light mode fixed colors, for that it is required to know what the light mode colors are. If you are seeding and use the overrides, and will switch between seeded and not seeded, you can provide the override for the not seeded values inprimary,secondaryortertiary, and the ref to their seed colors from light mode, in the light ref colors. If you always seed when using the overrides, you can also provide the seed colors in theprimary,secondaryortertiaryoverrides, the light refs fall through to these colors in that cases if not provided during seeding.Added style
navigationBarto enumFlexSystemNavBarStylethat use the color for default or themedNavigationBarbackground color on the system navigation bar helper.navigationBaroption does not require using the edge-to-edge config required when using transparent system navigation bar to see things behind it. Thetransparentoption sets edge-to-edge mode behind the scenes when used. This can cause some layout changes that must be considered in the app design when used. This is an optional way to style the system navigation bar to match the app's themedNavigationBarbackground color, without using edge-to-edge Android screen mode.Added
ListTiletheming support toFlexSubThemesDataand made correspondingFlexSubThemes.listTileThemeproperties use them inFlexColorSchemeasListTileThemetheming properties.FlexSubThemesDataproperties were added:listTileSelectedSchemeColor,listTileIconSchemeColor,listTileTextSchemeColor,listTileTitleTextStyle,listTileSubtitleTextStyle,listTileLeadingAndTrailingTextStyle,listTileTileSchemeColor,listTileSelectedTileSchemeColor,listTileContentPadding,listTileHorizontalTitleGap,listTileMinVerticalPadding,listTileStyle,listTileTitleAlignmentandlistTileControlAffinity.Added
SearchBarandSearchViewtheming support toFlexSubThemesDataand made correspondingFlexSubThemes.searchBarThemeandFlexSubThemes.searchViewThemeproperties use them inFlexColorSchemeasSearchBarThemeDataandSearchViewThemeDatatheming properties.FlexSubThemesDataproperties were added:searchBarBackgroundSchemeColor,searchViewBackgroundSchemeColor,searchBarElevation,searchViewElevation,searchBarRadius,searchViewRadius,searchViewHeaderHeight,searchBarTextStyle,searchViewHeaderTextStyle,searchBarHintStyle,searchViewHeaderHintStyle,searchViewDividerColor,searchBarShadowColor,searchBarTextCapitalization,searchBarPadding,searchBarConstraints,searchViewConstraintsandsearchUseGlobalShape.CHANGE
Changed all internal usage of
MaterialStatePropertyandMaterialStateto use newWidgetStatePropertyandWidgetStateintroduced in Flutter 3.22 and later.Static functions
FlexSubThemes.schemeColorandFlexSubThemes.onSchemeColornow support the updatedSchemeColorandColorScheme.Improved the theming logic for
Cardtheme.Card.outlinedvariant for the default case at least. This Flutter theming limitation and impact is thus now the same in FCS, as it is with vanilla FlutterThemeDataand itsCardTheme. It is still broken as mentioned in the above issue, but that is a Flutter theming issue and limitation that FCS cannot fix.Changed the
FlexSubThemes.inputDecoratorThemeto use onlyborderand its WidgetState for its theme. It offers more and nicer control over hover state than using the older legacy more limited border styles.FIX
Fixed #198 AppBar color issue when using seed generated scheme with key color locked.
Fixed that the Rectangular Slider value indicator did not default to
primarycolor when undefined, as intended in FCS M2 and M3 mode. Only the Drop style indicator defaulted to primary. This came from the framework defaulting the old M2 rectangular indicator to a complex, opacity and alpha blendedonSurfacegrey looking result.Why is blendedTextTheme deprecated?
The
blendTextThemefeature was originally made before Material-3's TextTheme was available, before it was fully known how it was going to be implemented. It was an approximation of the TextStyles that could be seen in early versions of Material-3 images. Since the actual Material-3 TextTheme is available, the tinted TextTheme feature is no longer required. While the FCS tinted TextTheme did provide an alternative version of the actual tint used in Material-3, the differences were quite subtle. Additionally, recent changes in Flutter make using it very verbose and complicated. Why it does so is explained in detail below.In Material-3 Typography 2021, the TextTheme and all styles in it are fully opaque and use onSurface as color on all TextStyles. In a seed generated ColorScheme, the text styles become primary color tinted, because the onSurface color by default has subtle primary tint. With FCS, you can modify the onSurface to black or white to avoid this, if so preferred.
In Material-2 Typography 2018 and 2014, some TextStyles in their TextThemes use partially transparent white or black colors, making them appear tinted when placed on lightly colored backgrounds. Such TextStyles also have lower contrast. If the Material-3 default text theme is used on background colors that are tinted with a color that deviates a lot in hue from the hue used as tint color by the TextTheme, it may not fit it so well. The Material-2 opacity-based text styles do not have this limitation. It is unknown why Material-3 switched to a fixed tint color instead of using the opacity-based approach used in Material-2, that is more universally usable on backgrounds with different tint colors.
In Material-3, some component themes override the default color of the default TextTheme TextStyles they use with
onSurfaceVariant. This color has slightly more tint and lower contrast than the defaultonSurface. This is used for elements in components that should have less emphasis. Many default Material-3 components also override the color in default TextTheme TextStyles they use withColorScheme.onSurfacecolor, that it actually already has in a default TextTheme. These two overrides results in that whatever color the default TextTheme TextStyles have, they will be overridden by theseColorSchemecolors. Resulting in that any custom-coloredTextThemeand itsTextStyles are not getting used by such Material-3 components and that the custom colors from the meticulously colored customTextTheme, are rarely visible anywhere in a Material-3 application. Material-2 component themes do not do this, nor did older Flutter versions of Material-3 component themes do this.An issue has been raised explaining the challenges this newer approach in Flutter causes when using custom colored text themes. If this issue is addressed, the tinted TextTheme feature in FCS may be brought back if it is a requested feature.
In current Flutter versions, using a custom-tinted TextTheme is rather pointless. You can, but it is not enough to define the TextTheme. You also have to pass each tinted TextStyle it has to the appropriate TextStyles in ALL component themes that override its colors, for it to have any effect. It is typically not worth the effort.
THEMES PLAYGROUND
NEW
The Theme Code view panel now has a toggle that allows you to generate the configured code for the theme as input suitable for a separate app theme file. It has static getters that you can use in your
MaterialApp'sthemeanddarkTheme.The Theme Code view got a long asked for feature, Themes Playground settings export and import! You can now export your configured theme settings to a JSON file and import them back into the Playground later. This is a great way to save your theme settings for later use or to share them with others. The exported JSON file contains all the internal controller settings values you have configured in the Playground that are needed to restore a given configuration state. This Playground feature was contributed by GitHub user @akiller in !PR 257. Thank you!
The contributed feature got enhanced with more error handling and a slightly refined UI to make it production ready.
As a further enhancement of the JSON export feature, the Themes Playground app also got the ability to convert the exported settings JSON config to a shareable URL. You can now share Playground settings with other Flutter developers.
On each theme settings panel, many controls now appear in two columns to reduce the need to scroll so much on wider media and see more controls on the same screen. The layout is panel width responsive and controls will be in one column as before on smaller media.
Split the "FAB and Chip" settings panels to separate panels FAB and Chip.
Split the "BottomAppBar and SearchBar" panels to separate panels SearchBar and BottomAppBar.
On the surface Color Blends settings panel, you can choose which surface color the scaffold background color will use as its starting point surface color and as base for the blend level and mode. You can also select any ColorScheme color and use it as an override for the scaffold background color. This will override any blended color result as well as the plain white and true black settings.
The ColorScheme settings panel got five new settings:
contrastLevelproperty inColorScheme.fromSeed. It is used to control the contrast level of the generated scheme colors. It will most likely land in the next stable Flutter release after 3.24. With FCS V8 you can use it already now.fixed,onFixed,fixedDimandonFixedVariantcolors, when a seed generatedColorSchemeis NOT being used.fixed,onFixed,fixedDimandonFixedVariantcolors to the Material-3 design specified values 90, 10, 80, 30 or and or opt-in on an alternative set 92, 6, 84, 12 that have higher contrast.onPrimaryContainer,onSecondaryContainer,onTertiaryContainerandonErrorContainerhave changed from tone 10 to 30 for LIGHT theme mode. This change will land in Flutter when the Material Color Utilities (MCU) package is updated to at least 0.12.0. This has not been done even in master (Sep 3, 2024).Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.